using System;
using Sinacor.Servico.Bovespa.Ordens.Service.DataContract.Request;
using Sinacor.Servico.Bovespa.Ordens.BusinessEntity;

namespace Sinacor.Servico.Bovespa.Ordens.Service.ServiceImplementation.Translator
{
    public static class TranslateBetweenAlterarJustificativaRequestAndJustificativa
    {

        public static Sinacor.Servico.Bovespa.Ordens.BusinessEntity.Justificativa TranslateAlterarJustificativaRequestToJustificativa(Sinacor.Servico.Bovespa.Ordens.Service.DataContract.Request.AlterarJustificativaRequest from)
        {
            Sinacor.Servico.Bovespa.Ordens.BusinessEntity.Justificativa to = new Sinacor.Servico.Bovespa.Ordens.BusinessEntity.Justificativa();
            to.IdentificadorJustificativa = from.IdentificadorJustificativa;
            to.TextoJustificativa = from.TextoJustificativa;
            if (to.Ordem == null)
                to.Ordem = new Sinacor.Servico.Bovespa.Ordens.BusinessEntity.Ordem();

            to.Ordem = new Sinacor.Servico.Bovespa.Ordens.BusinessEntity.Ordem();
            to.Ordem.DataOrdem = from.DataOrdem;
            to.Ordem.NumeroOrdem = from.NumeroOrdem;
            to.Ordem.NumeroOrdemSubSequencia = from.SubsequenciaOrdem;
            return to;
        }
    }
}

